package com.swt.gap.common.graph;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * neo4j 格式 图数据结构, property 以map格式
 *
 * @author sx
 * @date 2019/9/18 14:58
 */
@ApiModel
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Graph {
    @ApiModelProperty(value = "结点")
    private List<Node> nodes;

    @ApiModelProperty(value = "关系")
    private List<Link> links;

    @ApiModel
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Node {
        @ApiModelProperty(value = "实体Id")
        private String id;

        @ApiModelProperty(value = "实体属性")
        private Map<String, Object> properties ;


        @ApiModelProperty(value = "图标")
        private String icon;

        @ApiModelProperty(value = "标签")
        private List<String> labels;

        @ApiModelProperty(value = "显示文本")
        private String name;

        @ApiModelProperty("库类型，1百科 2qb")
        private Integer type;

    }

    @ApiModel
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Link {
        @ApiModelProperty(value = "关系id")
        private String id;

        @ApiModelProperty(value = "起始实体Id")
        private String startNodeId;

        @ApiModelProperty(value = "终止实体id")
        private String endNodeId;

        @ApiModelProperty(value = "关系类型")
        private String type;

        @ApiModelProperty(value = "关系属性")
        private Map<String, Object> properties;

        @ApiModelProperty(value = "合并类型")
        private String mergeType;

        @ApiModelProperty(value = "本体关系id")
        private Integer ontologyRelationshipId;

        @ApiModelProperty(value = "权重")
        private Integer weight;
    }
//    @ApiModel
//    @Data
//    public static class Property {
//        @ApiModelProperty(value = "属性名")
//        private String key;
//
//        @ApiModelProperty(value = "属性值")
//        private String value;
//    }
}
